package algorithmCompetition;

public class ALGO_121 {
    static int result = 0;
    static int m = 1;
    static int n = 5;

    public static void main(String[] args) {
        int k=1;
        int result = k*n+m;
        result = function(result,0);
        while (result == 0){
            k++;
            result = k*n+m;
            result = function(result,0);
        }
        System.out.println(result);
    }

    public static int function(int result,int k){
        if(k == n){
            return result;
        }
        if(result%((n-1)*1.0) != 0){
            return 0;
        }
        result = result*n/(n-1)+m;
        return function(result,k+1);
    }
}
